<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>
<@head>
<link rel="stylesheet" href="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.css"/>
</@head>
<@body>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/moment.min.js"></script>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.js"></script>
<script src="/misc/adminlte-2.3.7/plugins/iCheck/icheck.min.js"></script>
<script src="/misc/app/js/salesman_cash_list.js"></script>
</@body>
<@layout_default>
<div class="box">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation"  class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">待支付</a></li>
        <li role="presentation"><a href="/salesmanCash/paidList" >已支付</a>
        </li>
    </ul>
    <div class="box-header with-border">
        <form name="form_query" class="form-inline" action="/salesmanCash/list">
            <input type="hidden" id="cTimeS_hidden" value="${timeLimitStart!}" />
            <input type="hidden" id="cTimeE_hidden" value="${timeLimitEnd!}" />
            <span class="pull-right text-muted">共 ${pagelist.resultTotal} 条记录</span>
            <input type="hidden" id="resultTotal_hidden" value="${pagelist.resultTotal}" />
            <div class="input-group">
                <div class="input-group-addon">产品</div>
                <input type="text" class="form-control" style="width: 260px" name="proName" value="${proName!}" placeholder=""/>
            </div>

            <div class="input-group">
                <div class="input-group-addon">申请时间</div>
                <input type="text" class="form-control" id="cTime_start" name="timeLimitStart" size="18">
            </div>
            <div class="input-group"> 至 </div>
            <div class="input-group">
                <input type="text" class="form-control" id="cTime_end" name="timeLimitEnd" size="18">
            </div>

            <div class="input-group">
                <div class="input-group-addon">促销员</div>
                <input type="text" class="form-control" style="width: 260px" name="saleman" value="${saleman!}" placeholder="名称或编码"/>
            </div>

            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>

            <button type="button" class="btn btn-warning" id="batch_pay"><i class="fa fa-search"></i> 批量支付</button>
           
        </form>
    </div>
    <!-- /.box-header -->
    <div class="box-body mailbox-messages" id="mailbox-messages">
        <table class="table table-striped table-hover">
            <tr>
                <td><button type="button" class="btn btn-default btn-sm checkbox-toggle" style=" border-color: rgba(255,255,255,0.15);"><i class="fa fa-square-o"></i>
                </button></td>
                <th>申请编号</th>
                <th>提现产品</th>
                <th>瓶数</th>
                <th>促销员编码</th>
                <th>促销员姓名</th>
                <th>申请时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <#if (pagelist.result?size > 0)>
                <#list pagelist.result as item>
                    <tr>
                        <td>
                            <input type="hidden" id="product_${item.id}" value="${item.proId!}"/>
                            <input type="hidden" id="salesman_id_${item.id}" value="${item.salesmanId!}"/>
                            <input type="hidden" id="totalprize_${item.id}" value="${item.totalprize?string('0.00')}"/>
                            <input type="hidden" id="num_${item.id}" value="${item.num!}"/>
                            <input type="hidden" id="unitprize_${item.id}" value="${item.unitprize?string('0.00')}"/>
                            <input type="hidden" id="openid_${item.id}" value="${item.openid!}"/>
                            <input type="hidden" id="id${item.id}" value="false"/>
                            <input type="checkbox"  id="${item.id}" name ="node_checker" clicks ="checked">
                        </td>
                        <td>${item.code!}</td>
                        <td>${item.proName!}</td>
                        <td>${item.num!}</td>
                        <td>${item.salesmanCode!}</td>
                        <td>${item.salesmanName}</td>
                        <td>${item.c_time?number_to_datetime}</td>
                        <td><#if item.pay_state==0><span class="text-green">未支付</span><#elseif item.pay_state==2><span class="text-yellow">支付中</span><#else><span class="text-danger">支付失败</span></#if></td>
                    	<td>
                            <#if item.pay_state!=2>
                                <button type="button" class="btn btn-default btn-xs btn_pay" name="btn_pay"  data-pay-id="${item.id?c}">支付</button>
                            </#if>
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="9"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>
        </table>
        <#--<table class="table table-striped table-hover">-->
        	<#--<tr>-->
        		<#--<span class="pull-right text-muted">共 ${pagelist.resultTotal} 条记录</span>-->
        	<#--</tr>-->
        <#--</table>-->

        <table class="table table-striped table-hover">
            <tr>
                <td colspan="13" style="text-align:right;background-color:white;">
                    <a href="javascript:void(0);" name="btn_export"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
                </td>
            </tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/salesmanCash/list?proName=${proName!}&page=$page&saleman=${saleman!}&timeLimitStart=${timeLimitStart!}&timeLimitEnd=${timeLimitEnd!}",pagelist.page,pagelist.pageTotal/>
    </div>
</div>

<!-- md_edit_salesman -->
<div class="modal" id="md_edit_price" tabindex="-1">
    <div class="modal-dialog"  style=" width: 300px;"role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-pencil-square-o"></i> 此次共计支付</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_edit_price">
                    <input type="hidden" name="productid"/>
                    <input type="hidden" name="productname"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><strong class="bold">￥</strong> </label>
                        <div class="col-sm-10">
                            <#--<input type="text" class="form-control" placeholder="每瓶支付费用" name="price" onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')" />-->
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" name="btn_save_price">保存</button>
            </div>
        </div>
    </div>
</div>


</@layout_default>